<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * DadosResponsavel filter form base class.
 *
 * @package    filters
 * @subpackage DadosResponsavel *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseDadosResponsavelFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_endereco'           => new sfWidgetFormDoctrineChoice(array('model' => 'Endereco', 'add_empty' => true)),
      'nm_responsavel'        => new sfWidgetFormFilterInput(),
      'ds_grau_parentesco'    => new sfWidgetFormFilterInput(),
      'dt_nascimento'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'nu_identidade'         => new sfWidgetFormFilterInput(),
      'ds_expedida_por'       => new sfWidgetFormFilterInput(),
      'nu_cpf'                => new sfWidgetFormFilterInput(),
      'nu_telefone'           => new sfWidgetFormFilterInput(),
      'nu_telefone_comercial' => new sfWidgetFormFilterInput(),
      'nu_telefone_celular'   => new sfWidgetFormFilterInput(),
      'nm_profissao'          => new sfWidgetFormFilterInput(),
      'nm_empresa'            => new sfWidgetFormFilterInput(),
      'nm_cargo'              => new sfWidgetFormFilterInput(),
      'vl_salario'            => new sfWidgetFormFilterInput(),
      'created_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'deleted'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'id_endereco'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Endereco', 'column' => 'id_endereco')),
      'nm_responsavel'        => new sfValidatorPass(array('required' => false)),
      'ds_grau_parentesco'    => new sfValidatorPass(array('required' => false)),
      'dt_nascimento'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'nu_identidade'         => new sfValidatorPass(array('required' => false)),
      'ds_expedida_por'       => new sfValidatorPass(array('required' => false)),
      'nu_cpf'                => new sfValidatorPass(array('required' => false)),
      'nu_telefone'           => new sfValidatorPass(array('required' => false)),
      'nu_telefone_comercial' => new sfValidatorPass(array('required' => false)),
      'nu_telefone_celular'   => new sfValidatorPass(array('required' => false)),
      'nm_profissao'          => new sfValidatorPass(array('required' => false)),
      'nm_empresa'            => new sfValidatorPass(array('required' => false)),
      'nm_cargo'              => new sfValidatorPass(array('required' => false)),
      'vl_salario'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'created_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'deleted'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('dados_responsavel_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'DadosResponsavel';
  }

  public function getFields()
  {
    return array(
      'id_dados_responsavel'  => 'Number',
      'id_endereco'           => 'ForeignKey',
      'nm_responsavel'        => 'Text',
      'ds_grau_parentesco'    => 'Text',
      'dt_nascimento'         => 'Date',
      'nu_identidade'         => 'Text',
      'ds_expedida_por'       => 'Text',
      'nu_cpf'                => 'Text',
      'nu_telefone'           => 'Text',
      'nu_telefone_comercial' => 'Text',
      'nu_telefone_celular'   => 'Text',
      'nm_profissao'          => 'Text',
      'nm_empresa'            => 'Text',
      'nm_cargo'              => 'Text',
      'vl_salario'            => 'Number',
      'created_at'            => 'Date',
      'updated_at'            => 'Date',
      'deleted'               => 'Boolean',
    );
  }
}